/*
package com.devshephard.framework.config;


import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

*/
/**
 * mybatis-plus配置
 * 
 *//*

@Configuration
@EnableConfigurationProperties(MybatisPlusProperties.class)
public class MybatisPlusConfig {

    */
/**
     * 分页插件
     *//*

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor page = new PaginationInterceptor();
        return page;
    }

    @Autowired
    private MybatisPlusProperties mybatisPlusProperties;

    */
/** 是否启用自动重新加载mybatis的xml（mybatis 热加载） *//*

    @Value("${mybatis.xml.automatically.reload:false}")
    private boolean automaticallyReloadMybatis;
    */
/** 热加载扫描间隔时间 *//*

    @Value("${mybatis.xml.automatically.interval.seconds:5}")
    private int automaticallyReloadIntervalSecond;

    */
/**
     * 缓存自动刷新插件
     *
     * @return
     *//*

    @Bean
    public MybatisMapperRefreshRunnable mybatisMapperRefreshRunnable(ApplicationContext applicationContext,
        SqlSessionFactory sqlSessionFactory) {
        long mills = System.currentTimeMillis();
       // if (Framework.isProd() || !automaticallyReloadMybatis) {
        if (!automaticallyReloadMybatis) {
            // 正式环境禁止使用
            return null;
        }
        Set<Resource> mapperLocations = new HashSet<>();
        for (String location : mybatisPlusProperties.getMapperLocations()) {
            try {
                mapperLocations.addAll(Arrays.asList(applicationContext.getResources(location)));
            } catch (Exception e) {
            }
        }

        Resource[] array = mapperLocations.toArray(new Resource[mapperLocations.size()]);
        // 预热，记录
        MybatisMapperRefresh.getInstance(array, sqlSessionFactory).initFileSet();

        MybatisMapperRefreshRunnable mybatisMapperRefresh = null;
        boolean enableAutoRefresh = automaticallyReloadMybatis;
        // 生产环境不启动
        if (enableAutoRefresh) {
            mybatisMapperRefresh = new MybatisMapperRefreshRunnable(array, sqlSessionFactory, 10,
                automaticallyReloadIntervalSecond, enableAutoRefresh);
        }
        System.out.println("mybatis 热加载耗时（毫秒）：" + (System.currentTimeMillis() - mills));
        return mybatisMapperRefresh;
    }
}*/
